package com.Dao.Imp;
import com.Dao.UpdateAuthorDao;
import com.Utils.C3P0Utils;
import com.pojo.Author;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.dbutils.QueryRunner;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
@Service
@Slf4j
public class UpdateAuthorDaoImp implements UpdateAuthorDao {
    @Override
    public void updateAuthor(Author author) throws SQLException {
        QueryRunner queryRunner=new QueryRunner(C3P0Utils.getDataSource());
        String sql="update author set username=?,aliasName=?,wechat=?,profile=? where id=?";
        queryRunner.update(sql,author.getUsername(),author.getAliasName(),author.getWechat(),author.getProfile(),author.getId());
    }
}
